package com.sh.data.engine.application.model.dto.datadev;

import com.sh.data.engine.domain.datadev.offline.model.domain.OfflineDevTaskFlowDetailDomain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Tolerate;

import java.util.List;

/**
 * @author: mengzheng.mhc
 * @date: 2024/7/10 15:54
 */
@Data
public class OfflineDevTaskFlowDetailResponse {

    @Schema(description = "工作流节点id")
    private Long nodeId;

    @Schema(description = "所有节点")
    private List<OfflineDevTaskFlowDetailDomain.Node> nodes;

    @Schema(description = "节点连线")
    private List<OfflineDevTaskFlowDetailDomain.Edge> edges;

    @Schema(description = "是否锁住")
    private Integer isLock;

    private Integer xxlJobId;

    @Data
    @Builder(toBuilder = true)
    @Schema
    public static class Node {

        @Schema(description = "节点id")
        private Long id;

        @Schema(description = "节点名")
        private String nodeName;

        @Schema(description = "节点类型")
        private Integer nodeType;

        @Schema(description = "apiType")
        private Integer apiType;

        @Schema(description = "x坐标")
        private String x;

        @Schema(description = "y坐标")
        private String y;

        @Schema(description = "是否支持克隆")
        private Boolean supportClone;

        @Tolerate
        public Node() {
        }
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema
    public static class Edge {

        @Schema(description = "任务id")
        private Long from;

        @Schema(description = "任务id")
        private Long to;

        @Schema(description = "0-执行成功后执行   1-执行失败后执行 2-执行失败成功都执行")
        private Integer status;

        @Schema(description = "0-只能删除 ")
        private Integer fixed;
    }
}
